<%@ page contentType="text/html;charset=utf-8" %>
<%@page import="com.scw.util.CommonNameUtil"%>
<%@page import="com.scw.model.SysUser"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<script type="text/javascript" src="${Root }/js/jquery-1.4.2.js"></script>
<script language="javascript" src="${Root }/js/validator.js"></script>
<script type="text/javascript" src="${Root }/js/jquery-1.4.2.js"></script>
<script type="text/javascript">
					$(document).ready( function() {
						$("#topdivtabs a").each(function(i){
						 $(this).removeClass();
						 if($.trim($(this).html())==$.trim($("#toptabs").val())){
							 $(this).addClass("actived");
							 $("#topdivmenu"+i).show();
							 $("#topdivmenu"+i+" a").each(function(i){
							 	$(this).removeClass();
								 if($.trim($(this).html())==$.trim($("#topmenu").val())){
									 $(this).css("color","blue");
									 }
							 	});
							 }
						 });
					});
					
	function checkCode(){
		var img = document.getElementById("img1");
		img.src=img.src+"?a="+Math.random()+100 ;
	}
	
	function houtai(){
		$("#topdivtabs a").each(function(i){
						 $(this).removeClass();
						 $("#topdivmenu"+i).hide();
		});
		$("#ht").addClass("actived");
		$("#topdivmenu3").show();
	}
	
	function submitValidator(fromid,type){
	if(!Validator.Validate(fromid,type)){ return false;}
	}
	
	  function SetHome(obj) {  
            var vrl = "http://" + getHost(document.URL);  
            try {  
                obj.style.behavior = 'url(#default#homepage)'; 
                obj.setHomePage(vrl);  
           }  
            catch (e) {  
                if (window.netscape) {  
                   try {  
                        netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");  
                    }  
                    catch (e) {  
                        alert("此操作被浏览器拒绝！\n请在浏览器地址栏输入“about:config”并回车\n然后将[signed.applets.codebase_principal_support]设置为'true'");  
                    }  
                    var prefs = Components.classes['@@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);  
                    prefs.setCharPref('browser.startup.homepage', vrl);  
                }  
            }  
        }  
  
        var getHost = function (url) {  
            var host = "null";  
            if (typeof url == "undefined" || null == url)  
                url = window.location.href;  
            var regex = /.*\:\/\/([^\/]*).*/;  
            var match = url.match(regex);  
            if (typeof match != "undefined" && null != match)  
                host = match[1];  
            return host;  
        }  
</script>
<div id="MyHead">
	<!--页面头部-->
	<div id="top">

		<div id="topleft">
		
			<a onclick="SetHome(this);return false;" href="#">设为主页</a>&nbsp;|&nbsp;
			<a href="${Root }/helpForNew/index.html">如何使用</a>
		</div>
		<div id="toprihgt" style="width: auto;">
		<%
		SysUser sysUser=(SysUser)request.getSession().getAttribute(CommonNameUtil.SessionUser);
		if(sysUser !=null &&sysUser.getId()!=null){ 
		%>
			您好： <%=sysUser.getNick_name() %>&nbsp;&nbsp;,欢迎使用本网站！ 
			<a href="${Root }/quit.action?id=<%=sysUser.getId() %>">退出</a>
		<%}else{ %>
		<form id="headform1" name="headform1" action="${Root }/login.action" onsubmit="return submitValidator(document.headform1,2);" method="post">
					用户名
						<input style="color: #AEAEAE"  type="text" name="sysUser.user_name" style="leght" datatype="Require" msg="请填写用户名" value="" />
						密码
							<input type="password" name="sysUser.password" datatype="Require" msg="请填写密码" />
							<img src="${Root }/securityCode" id="img1"  class="img_2" onclick="checkCode();"/>
							验证码
							<input type="text" name="vcode"  size="4" datatype="Require" msg="请填写验证码" />&nbsp;
							<input type="submit" style="color: #AEAEA" value="登陆"/>
							&nbsp;&nbsp;
							<a href="getpassword.html">&nbsp;找回密码？&nbsp;</a>|<a href="register.jsp">&nbsp;&nbsp;注册&nbsp;</a>
		</form>
		<% 
		sysUser=new SysUser();
		} %>
				
				</div>
			</div>

			<div id="topmenu">
				<div class="banner">
					<div style="float: left; margin-top: -30px;">
						<a href="/index.html" ><img style="margin-left: 2px;" src="images/logo.gif"/> </a>&nbsp;
					</div>

					<div class="tabbar">
						<div id="topdivtabs" class="tabs">
							<a  href="${Root }/index.jsp" >首页</a>
								<a  href="${Root }/listlink.action">我的收藏</a>
						<a   href="${Root }/tag.html">热门便签</a>
						<%if(sysUser !=null && CommonNameUtil.ADMIN.equals(sysUser.getUser_type())){ %>						
						<a   href="#" onclick="houtai()" id="ht">后台管理</a>
						<%} %>
						</div>
					</div>
					<div style="float: right; margin-right: 0px; margin-top: 4px;">
						<FORM id="formfind" name="formfind" action="" method=""
							target="_blank" onsubmit="return search11(this);">
							<input style="color: #AEAEAE" type="text" name="word"  value="搜索收藏关键词" />
							&nbsp;&nbsp;
							<input id=submit type=submit value="搜索" name=submit>
						</form>
					</div>
				</div>
				<div class="bar"></div>
				<div class="menu_s">
					<div id="topdivmenu0" class="menu_t" style="display: none">
						<a href="${Root }/index.jsp" >首页</a>
						<a href="${Root }/allsite.html" >网站大全</a><a
							href="${Root }/helpForNew/index.jsp" >使用说明</a>
					</div>
					<div id="topdivmenu1" class="menu_t" style="display: none">
						<a href="${Root }/listlink.action" >我的收藏</a><a
							href="${Root }/listtip.action?id=<%=sysUser.getId() %>" >我的便签</a>
							<a href="${Root }/edituser.action?id=<%=sysUser.getId() %>" >个人资料</a>
							<a href="${Root }/linkimportLink.action" >导入收藏夹</a>
							<a href="${Root }/linkexportLink.action" >导出收藏夹</a>
					</div>
					<div id="topdivmenu2" class="menu_t" style="display: none">
						
					</div>
					
					<div id="topdivmenu3" class="menu_t" style="display: none">
						<a href="${Root }/alluser.action" >用户资料</a>
						<a href="${Root }/adlist.action" >广告位</a>
						<a href="${Root }/edituser.action" >所有收藏</a>
					</div>
				</div>
			</div>

		</div>